<template>
  <div class="app-container">
    <div class="zd3">
      <div class="zd3-title">
				<p>
					<span>执行标准</span>
					<input v-model="usename" type="text" placeholder="请输入执行标准名称" />
				</p>
				<p>
					<span>提交人</span>
					<input v-model="usepeople" type="text" placeholder="请输入提交人" />
				</p>
        <h3 @click="getList">查询</h3>
				<h4 @click="resetList">重置</h4>
				<h3 @click="addList" style="background: #0093FF">添加执行标准</h3>
      </div>
      <div class="zd3-btm">
        <el-table
          :data="tableData"
          border
					v-loading="loading"
          style="width: 100%;border-radius: 8px;"
        >
          <el-table-column type="index" align="center" label="序号" width="80" />
          <el-table-column align="center" prop="standard" label="执行标准"/>
					<el-table-column align="center" prop="submitperson" label="提交人" width="180"/>
					<el-table-column align="center" prop="insertTime" width="200" label="提交时间" />
					<el-table-column align="center" width="200" label="操作">
					  <template slot-scope="scope">
							<el-button type="text" size="small" @click="write(scope.row)">修改</el-button>
              <el-button type="text" size="small" @click="download(scope.row)">下载</el-button>
					    <el-popconfirm
					      placement="top"
					      hideIcon
					      title="是否要删除此行？"
					      @onConfirm="deleteRow(scope.row)"
					    >
					      <el-button type="text" size="small" slot="reference">删除</el-button>
					    </el-popconfirm>
					  </template>
					</el-table-column>
        </el-table>
        <el-pagination
          background
          hide-on-single-page
          layout="prev, pager, next"
          :total="total"
          @prev-click="goPrev"
          @next-click="goNext"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { getEwmBiaozhun,deleteEwmBiaozhun } from '@/api/ewmApi'
export default {
  data() {
    return {
      usename: "",
      usepeople: "",
      total: 1,
      tableData: [],
      dialogVisible: false,
      tempData: "",
      tempIndex: -1,
			loading: true
    };
  },
  mounted(){
    this.getList()
  },
  methods: {
    changeValue3(value) {},
    write(item, index) {
      console.log(item)
      this.$router.push({
				name:'Xinzengzhixing',
				params: {
					options: JSON.stringify(item)
				}
			})
    },
		getList(){
      const param = {
        standard: this.usename ? this.usename : null,
        submitperson: this.usepeople ? this.usepeople : null
      }
      getEwmBiaozhun(param).then(res => {
        console.log(res)
        this.tableData = res.data
				this.loading = false
      })
    },
		resetList(){
			this.usename = ""
      this.usepeople = ""
		},
		addList(){
			this.$router.push({
				name:'Xinzengzhixing'
			})
    },
    download(item){
      console.log(item)
      window.location.href = item.standurl
    },
    deleteRow(item) {
      deleteEwmBiaozhun(item.id).then(res => {
        console.log(res)
        this.$message({
          showClose: true,
          message: res.message,
          type: 'success'
        })
        this.getList()
      })
      console.log("删除");
    },
    goPrev(page) {
      console.log(page);
    },
    goNext(page) {
      console.log(page);
    },
  }
};
</script>

<style lang="scss" scoped>

/deep/.el-button--primary {
  color: #fff;
  background-color: #18a05e !important;
  border-color: #18a05e !important;
}
/deep/.el-button--primary:hover,
.el-button--primary:focus {
  background: #18a05e !important;
  border-color: #18a05e !important;
  color: #fff !important;
}
/deep/.el-button:hover,
.el-button:focus {
  color: #18a05e;
  background-color: transparent;
}
/deep/.el-button--primary {
  color: #fff;
  background-color: #18a05e;
  border-color: #18a05e;
}
/deep/.el-button--text {
  color: #00c666 !important;
}
.app-container {
  padding: 10px;
}
.proimg{
	width: 30px;
	height: 30px;
}
.inps {
  width: 100%;
  height: 32px;
  line-height: 32px;
  padding-left: 10px;
  background: none;
  border: none;
  color: #333;
}
.inps-active {
  width: 100%;
  height: 32px;
  line-height: 32px;
  padding-left: 10px;
  // background:#ccc;
  border: none;
  color: #333;
}
.zd3-title {
	height: 80px;
	display: flex;
	align-items: center;
	padding: 0 20px;
	position: relative;
	background: #ffffff;
	border-radius: 8px;
	border: 1px solid rgba(0, 0, 0, 0.1);

	> p {
		font-size: 14px;
		color: #333;
		margin-right: 20px;

		> span {
			padding-right: 20px;
		}

		> input {
			width: 150px;
			height: 32px;
			// background: #ccc;
			border-radius: 3px;
			border: 1px solid #ccc;
			padding-left: 10px;
			color: #333;
		}
	}

	> h3 {
		// width: 64px;
		height: 32px;
		background: #18a05e;
		border-radius: 3px;
		padding: 0 10px;
		color: #fff;
		font-size: 14px;
		line-height: 32px;
		font-weight: 100;
		text-align: center;
		cursor: pointer;
	}

	> h4 {
		padding: 0 10px;
		height: 32px;
		border-radius: 3px;
    margin: 0 30px 0 30px;
		border: 1px solid rgba(0, 0, 0, 0.1);
		color: #333;
		font-size: 14px;
		line-height: 32px;
		font-weight: 100;
		text-align: center;
		cursor: pointer;
	}
}
.zd3-btm .btn-prev:after {
  content: "上一页";
}
.zd3-btm .btn-next:before {
  content: "下一页";
}
.zd3-btm .btn-prev,
.zd3-btm .btn-next {
  width: 65px;
}
.zd3-btm {
  background: rgba(255, 255, 255, 1);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 10px;
  overflow: hidden;
  &-title {
    display: flex;
    align-items: center;
    height: 70px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
    > p {
      text-align: center;
      font-size: 16px;
      color: #333;
    }
  }
  .el-pagination {
		white-space: nowrap;
		padding: 15px 5px;
		color: #303133;
		font-weight: bold;
	}
  .addDate {
    margin: 20px 32px 10px 32px;
    height: 32px;
    border-radius: 3px;
    text-align: center;
    line-height: 32px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    border: 1px dashed rgba(0, 0, 0, 0.25);
  }
  .el-button--text {
    margin: 0 15px;
  }
}

</style>
